package dao

import (
	"gitee.com/lv_baobao/gcore/dbUtils"
	"gitee.com/lv_baobao/gcore/helper"
	"gitee.com/lv_baobao/gcore/testing/models"
)

type UserGroupDao struct {
	*dbUtils.BaseDao
}

func NewUserGroupDao() *UserGroupDao {
	return &UserGroupDao{
		BaseDao: &dbUtils.BaseDao{
			TableName: "UserGroup",
		},
	}
}

func (this *UserGroupDao) SearchPageList(pageIndex int, pageSize int) *helper.QueryResult {
	var res = new(helper.QueryResult)
	var list = make([]models.UserGroup, 0)
	return this.Queryable().OrderByDesc("Id").Page(pageIndex, pageSize, &list)
	return res
}

func (this *UserGroupDao) GetUserGroupsByIds(ids []int) []models.UserGroup {
	var list = make([]models.UserGroup, 0)
	this.Queryable().WhereIn("id", dbUtils.ToInterfaceArray(ids), true).List(&list)
	return list
}
